package com.lagou.listener;

import com.lagou.pojo.Result;
import com.lagou.service.MqService;
import com.rabbitmq.client.Channel;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class MqListener {
    @Autowired
    MqService mqService;

    @RabbitListener(queues = "q.go.dlx")
    public void broadcastMeetingAlarm(Message message, Channel channel) throws IOException {
        String orderId = new String(message.getBody(), "UTF-8");
        Result result = mqService.orderExpire(orderId);
        System.out.println(result.getMsg());
    }

}
